package socketmvc.core.processor.bean.optimizer.ret;

import socketmvc.core.context.IContext;
import socketmvc.core.exception.NotSupportReturnTypeException;
import socketmvc.core.packets.basic.IPacket;
import socketmvc.core.processor.bean.ProcessorMethodReturn;

import java.lang.reflect.Type;

public class NotSupportReturnTypeValOptimizer extends ProcessorMethodReturn.ValOptimizer {

    private final Type returnType;

    public NotSupportReturnTypeValOptimizer(Type returnType) {
        this.returnType = returnType;
    }

    @Override
    public IPacket value(IContext context, IPacket packet, Object returnVal) {
        throw new NotSupportReturnTypeException("不支持的返回类型 ："+ returnType.getTypeName());
    }
}
